From 25fc567ba8a0cd199e48bfa82863247d953784ea Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sun, 30 Aug 2020 20:59:29 +0200
Subject: [PATCH] Makefile: add -fno-builtin

Build with gcc 10 fails on:

/srv/storage/autobuild/run/instance-2/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: src/foundation/startup.o: in function `reset_handler':
/srv/storage/autobuild/run/instance-2/output-1/build/am33x-cm3-11107db2f1e9e58ee75d4fe9cc38423c9a6e4365/src/foundation/startup.c:177: undefined reference to `memcpy'

This is due to the fact that gcc 10 replaces the following statement by
a memcpy call:

*puldest++ = *pulsrc++;

To fix this build failure, add -fno-builtin

Fixes:
 - http://autobuild.buildroot.org/results/a991e6efa012df518ff1bb35017ad2c96c8feedc

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index fe3d844..fa24d4b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ CFLAGS =-march=armv7-m -mcpu=cortex-m3 -mthumb -nostdlib -Wall -Wundef \
 	-Werror-implicit-function-declaration -Wstrict-prototypes \
 	-Wdeclaration-after-statement -fno-delete-null-pointer-checks \
 	-Wempty-body -fno-strict-overflow -fno-stack-protector \
-	-fno-pie -g -I$(INCLUDES) -O2
+	-fno-pie -fno-builtin -g -I$(INCLUDES) -O2
 LDFLAGS =-nostartfiles -fno-exceptions -Tfirmware.ld
 
 EXECUTABLE=am335x-pm-firmware.elf
-- 
2.28.0

